import * as actionTypes from './constants'

const initState = {
  currentPage: 0, // 当前页码
  totalCount: 0, // 总数据
  houseList: [], // 数据列表
  isLoading: false,
}

function reducer(state = initState, action) {
  switch (action.type) {
    case actionTypes.CHANGE_CURRENT_PAGE:
      return { ...state, currentPage: action.currentPage }
    case actionTypes.CHANGE_HOUSE_LIST:
      return { ...state, houseList: action.houseList }
    case actionTypes.CHANGE_TOTAL_COUNT:
      return { ...state, totalCount: action.totalCount }
    case actionTypes.CHANGE_IS_LOADING:
      return { ...state, isLoading: action.isLoading }
    default:
      return state
  }
}
export default reducer
